package com.wengluobiancheng.demo05;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo01 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(19901);
        Socket accept = ss.accept();
        BufferedInputStream bis = new BufferedInputStream(accept.getInputStream());
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("D:\\itheima\\1.jfif"));
        int a;
        while ((a = bis.read()) != -1) {
            bos.write(a);
        }
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(accept.getOutputStream()));
        bw.write("...");
        bw.newLine();
        bw.flush();
        bw.close();
        accept.close();
        ss.close();
    }
}
